﻿Imports System.Web.UI
Imports System.Collections.Generic
Imports SISSAT.BusinessLayer.DomainModels
Imports SISSAT.WebDevelopment.Views
Imports SISSAT.BusinessLayer.Views
Imports SISSAT.BusinessLayer.DataViews

Namespace [Shared].UserControls
    Public Class StudentListControl
        Inherits UserControl
        Implements IStudentListControlView

#Region "Properties"

        Property Presenter As StudentListControlPresenter

#End Region

#Region "IStudentListControlView"

        Public Property IsUserAnInstructorForSchedule As Boolean Implements IStudentListControlView.IsUserAnInstructorForSchedule

        Public ReadOnly Property InstructorId As Integer Implements IStudentListControlView.InstructorId
            Get
                Return SISSATPageBase.User.Employee.EmployeeId
            End Get
        End Property

        Public Property IsGradeEditable() As Boolean Implements IStudentListControlView.IsGradeEditable

        Public ReadOnly Property ScheduleId As Integer Implements IStudentListControlView.ScheduleId
            Get
                Return Convert.ToInt32(HttpContext.Current.Request.QueryString("scid"))
            End Get
        End Property

        Public WriteOnly Property RepeaterDataSource As IEnumerable(Of StudentListDataView) Implements IStudentListControlView.RepeaterDataSource
            Set(value As IEnumerable(Of StudentListDataView))
                studentRepeater.DataSource = value
                studentRepeater.DataBind()
            End Set
        End Property

        Public Event OnInitialization(semester As Semesters, schoolYear As Integer) Implements IStudentListControlView.OnInitialization

#End Region

#Region "Events"

        Private Sub PageInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            Presenter = New StudentListControlPresenter(Me)
            RaiseEvent OnInitialization(SISSATPageBase.Semester, SISSATPageBase.SchoolYear)
        End Sub

#End Region

    End Class
End Namespace
